package com.hnou.boxuegu.utils;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.hnou.boxuegu.bean.BannerBean;
import com.hnou.boxuegu.bean.CourseBean;
import com.hnou.boxuegu.bean.ExercisesBean;

import java.lang.reflect.Type;
import java.util.List;

public class JsonParse {
    private static JsonParse instance;

    private JsonParse() {
    }

    public static JsonParse getInstance() {
        if (instance == null) {
            instance = new JsonParse();
        }
        return instance;
    }

    public List<ExercisesBean> getExecriseList(String json) {
        Gson gson = new Gson();
        Type listType = new TypeToken<List<ExercisesBean>>() {
        }.getType();
        List<ExercisesBean> exercisesList = gson.fromJson(json, listType);
        return exercisesList;
    }
}